#ifndef FRIEND_H
#define FRIEND_H

#include <QWidget>
#include <QTextEdit>
#include <QListWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>

#include "online.h"

class Friend : public QWidget
{
    Q_OBJECT
public:
    explicit Friend(QWidget *parent = nullptr);
    void showAllOnlineUsr(PDU *pdu); // 展示所有在线用户
    void updateFriendList(PDU *pdu); // 刷新好友列表
    static Friend &getInstance();
    QPushButton *getRefreshFriendButton();
    QString m_strSearchName;
signals:

public slots:
    void showOnline();
    void searchUsr(); // 查找用户
    void flushFriend(); // 刷新好友
    void delFriend(); // 删除好友

private:
    QTextEdit *m_pShowMsgTE;
    QListWidget *m_pFrientListWidget;
    QLineEdit *m_pInputMsgLE;

    QPushButton *m_pDelFriendPB;
    QPushButton *m_pFlushFriendPB;
    QPushButton *m_pShowOnlineUsrPB;
    QPushButton *m_pSearchUsrPB;
    QPushButton *m_pMsgSendPB;
    QPushButton *m_pPrivateChatPB;

    Online *m_pOnline;
};

#endif // FRIEND_H
